import {Pipe, PipeTransform} from "@angular/core";
import _ from 'lodash';

@Pipe({
	name: "addunit"
})
export class Addunit implements PipeTransform {
    transform(val: any,  arg: any) {
    	//需要显示万股单位的字段
    	let millionshares = [
    		"issuestotstock",
    		"ipototstock",
    		"webipototstock",
    		"totnegcap",
    		"minbuy",
    		"maxbuy",
    		"minnum"
    	];


    	if (arg && (millionshares.indexOf(arg.toLowerCase()) > -1)) {
        	return val += '（万股）';
    	}else if (arg === 'miniValue') {
    		return val += '（万元）';
    	}else if (arg === 'predictrate' || arg === 'RateForecast') {
    		return val += '（%）';
    	}else if (arg === 'IssuePrice') {
            return val += '（元）'
        }else {
    		return val;
    	}
    }
}
